<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class BaseMigration extends Migration
{
    protected $table;

    public function getTable()
    {
        if ($this->table == null)
        {
            throw new Exception("Table not set.");
        }

        return $this->table;
    }

    public function setTable(Blueprint $table)
    {
        $this->table = $table;
        return $this;
    }

    public function addForeign($key)
    {
        $this->addNullable("integer", $key);
        $this->getTable()->index($key);	// adddddddddddddddddddddddd
        return $this;
    }
}